/* 
float4x4 g_mWorldViewProjection;    // World * View * Projection matrix
struct VS_OUTPUT
{
	float4 Position   : POSITION;   // vertex position 
	float4 vPosition  : TEXCOORD0;
};


VS_OUTPUT RenderSceneVS( float4 vPos : POSITION )
{
	VS_OUTPUT Output;    
	Output.Position = mul(vPos, g_mWorldViewProjection);    
	Output.vPosition = abs(Output.Position);
	return Output;
}


struct PS_OUTPUT
{
	float4 RGBColor : COLOR0;  // Pixel color    
};

PS_OUTPUT RenderScenePS_Position( VS_OUTPUT In) 
{ 
	PS_OUTPUT Output;
	//Output.RGBColor = float4(1.0f, 0.0f, 0.0f, 1.0f);
	Output.RGBColor = In.vPosition;
	return Output;
}

//-----------------------------------------------------------------------------
// Technique: RenderScene
// Desc: Renders the scene with a vertex and pixel shader.
//-----------------------------------------------------------------------------
technique RenderScene
{
	pass P0
	{
		VertexShader = compile vs_2_0 RenderSceneVS();
		PixelShader = compile ps_3_0 RenderScenePS_Position();
		ZEnable = true;
	}
}
*/

//Use for Sobel edge detect.
//***********************Sobel edge detect**************************//
//****************fabs(deltaX)    +    fabs(deltaY)*****************//
//             --            --       --            --              //
//             |  1    2    1  |     |  1    0   -1  |              //
//             |  0    0    0  |  +  |  2    0   -2  |              //
//             | -1   -2   -1  |     |  1    0   -1  |              //
//             --            --      --            --              //
//******************************************************************//

/*
float2 NeighbourPixel8[8] = 
{
	{-1, -1}, { 0, -1}, { 1, -1}, 
	{-1,  0},           { 1,  0}, 
	{-1,  1}, { 0,  1}, { 1,  1}
};

float2 TexelKernel8[8]
<
string ConvertPixelsToTexels = "NeighbourPixel8";
>;


float NeighbourWeight[6] = 
{
	1, 2, 1, -1, -2, -1
};
float4 SobelPostProcessPS( float2 Tex : TEXCOORD0 ) : COLOR0
{

	float Orig = tex2D( g_samSrcColor, Tex ).z;
	if(Orig==1.0f)			clip(-1);
	
	//float Sum = tex2D(g_samSrcColor, Tex+TexelKernel8[0]).z;
	float Sum = 0.0;

	Sum += abs(	    tex2D(g_samSrcColor, Tex+TexelKernel8[0]).z 
				+ 2*tex2D(g_samSrcColor, Tex+TexelKernel8[1]).z
				+   tex2D(g_samSrcColor, Tex+TexelKernel8[2]).z
				-   tex2D(g_samSrcColor, Tex+TexelKernel8[5]).z
				- 2*tex2D(g_samSrcColor, Tex+TexelKernel8[6]).z
				-   tex2D(g_samSrcColor, Tex+TexelKernel8[7]).z );

	Sum += abs(	    tex2D(g_samSrcColor, Tex+TexelKernel8[0]).z
				+ 2*tex2D(g_samSrcColor, Tex+TexelKernel8[3]).z
				+   tex2D(g_samSrcColor, Tex+TexelKernel8[5]).z
				-   tex2D(g_samSrcColor, Tex+TexelKernel8[2]).z
				- 2*tex2D(g_samSrcColor, Tex+TexelKernel8[4]).z
				-   tex2D(g_samSrcColor, Tex+TexelKernel8[7]).z );

	Sum = Sum/(1-Orig);
	Sum = saturate(Sum);

	//return Sum;
	return float4(Sum, Sum, Sum, 1.0f);
}

*/